import { createRouter, createWebHistory } from "vue-router";
import Layout from "../layout/index.vue";
const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      component: Layout,
      redirect: "/manageData",
      children: [
        {
          path: "manageData",
          name: "manageData",
          component: () => import("../views/manageData/index"),
          meta: { title: "数据源管理", icon: "setting" }
        }
      ]
    },
    {
      path: "/addData",
      component: Layout,
      hidden: true,
      redirect: "/",
      children: [
        {
          path: "",
          name: "AddData",
          component: () => import("../views/addData/index"),
          meta: { title: "数据源添加", icon: "home" }
        }
      ]
    },
    {
      path: "/manageTable",
      component: Layout,
      redirect: "/",
      children: [
        {
          path: "",
          name: "manageTable",
          component: () => import("../views/manageTable/index"),
          meta: { title: "数据表管理", icon: "orange" }
        }
      ]
    },
    {
      path: "/addJavaScript",
      component: Layout,
      redirect: "/",
      children: [
        {
          path: "",
          name: "addJavaScript",
          component: () => import("../views/addJavaScript/index"),
          meta: { title: "脚本库添加", icon: "s-operation" }
        }
      ]
    },
    {
      path: "/manageJavaScriptTemplate",
      component: Layout,
      redirect: "/",
      children: [
        {
          path: "",
          name: "manageJavaScriptTemplate",
          component: () => import("../views/manageJavaScriptTemplate/index"),
          meta: { title: "脚本模板管理", icon: "s-tools" }
        }
      ]
    },
    {
      name: "404",
      path: "/404",
      hidden: true,
      component: () => import("../views/error-page/404.vue")
    },
    {
      hidden: true,
      path: "/:pathMatch(.*)*",
      redirect: {
        name: "404"
      }
    }
  ]
});

export default router;
